<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
    *{

        margin: 0px;
        padding: 0px;
        list-style: none;
    }
    /*文本框*/textarea{
        width: 400px;
        height: 100px;
       /* margin: 10px auto;*/
        margin-left: auto;
        margin-right: auto;
        margin-top: 30px;
        display: block;
        resize: none;
        outline: none;
        box-shadow: 0px 0px 10px 3px rgb(243, 153, 84) ;
    }
    button{
        width: 400px;
        

        margin: 0px auto;
        display: block;
        background: rgb(214, 172, 109);
        border: none;
        cursor: pointer;
        line-height: 40px;
        color: seashell;
    }
    ul{
        width: 400px;
        height: 400px;

        margin: 10px auto;
        display: block;

    }
    li{
        background: rgb(220, 168, 114);
        padding: 10px;
        margin-bottom: 10px;
        position: relative;/*相对定位*/

    }
    span{
        position: absolute;/*绝对定位*/
        font-size: 1px;
        right: -5px;
        top: -5px;
        cursor: pointer;/*小手*/
    }
    </style>
</head>
<body>
    <textarea name="" id="txt" cols="30" rows="10"></textarea>
    <button id="btn">发布微博</button>
    <ul id="con">
        <li>
            记得吃饭，记得微笑
            <p>2021-06-10</p>
            <span onclick="del(this)">No</span>
        </li>
    </ul>

    <script>
        var txt=document.getElementById('txt')
        var con=document.getElementById('con')
        var btn=document.getElementById('btn')


        btn.onclick=function(){

            var tag=document.createElement('li');
            tag.innerHTML=`${txt.value}
            <p>2021-06-10</p>
            <span onclick="del(this)">No</span>`;
            con.appendChild(tag)
            txt.value='';
        }

        function del(a){
            a.parentNode.parentNode.removeChild(a.parentNode)
        }
    </script>
</body>
</html>